import { typeModal } from "../Model/typeModal.js";

export const addTypeDao =async(typename,color)=>{
    return await typeModal.create({typename,color})
}

export const delTypeDao =async(id)=>{
    return await typeModal.findByIdAndDelete(id)
}

export const updateTypeDao =async(id,obj)=>{
    return await typeModal.findByIdAndUpdate(id,obj)
}

export const findAllTypeDao =async()=>{
    return await typeModal.find()
}

export const findTypeByPageDao =async(page,size)=>{
    return await typeModal.find().skip((page-1)*size).limit(size)
}

export const getAllCountDao =  async()=>{
    return await typeModal.countDocuments()
}
export const getTypeByIdDao = async (id)=>{
    return await typeModal.findById(id)   
}



